
import Relatorios.*;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Toolkit;
import javax.swing.JFrame;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Statement;
import java.sql.DriverManager;
import javax.swing.JOptionPane;


public class LayoutInterface extends javax.swing.JFrame {

public String login;
public String dataIncidente;
public String telefone;
public String tarefa;
public String dataFim;
public String notas;
public String tipo;
public String str;
public String dados;
private static Statement statement;
private static Connection connection;
private static ResultSet resultSet;
private static ResultSetMetaData metaData;


    public LayoutInterface() {
        initComponents();
        
        setExtendedState(JFrame.MAXIMIZED_BOTH);
        str = " Dados de consulta:";
        
        areaResultado.append(str + "\n");
        
        setLayout (new FlowLayout());
        pack();
        
    }

  private void Center()
    {
    Toolkit tk = Toolkit.getDefaultToolkit();
    Dimension screenSize = tk.getScreenSize();
    int screenWidth = screenSize.width - this.getWidth();
    int screenHeight = screenSize.height - this.getHeight();
    setLocation (screenWidth / 2, screenHeight /2);
    
    }
  
    @SuppressWarnings("unchecked")
    
    
    /*public static void main(String args[]) {

        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new LayoutInterface().setVisible(true);
            }
        });
    }*/
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        grupo = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        lbllogin = new javax.swing.JLabel();
        lbldataIncidente = new javax.swing.JLabel();
        lbltelefone = new javax.swing.JLabel();
        lbltarefa = new javax.swing.JLabel();
        lbltipo = new javax.swing.JLabel();
        optmigracao = new javax.swing.JRadioButton();
        optlista = new javax.swing.JRadioButton();
        optoutlook = new javax.swing.JRadioButton();
        optoutros = new javax.swing.JRadioButton();
        lbldataFim = new javax.swing.JLabel();
        lblnotas = new javax.swing.JLabel();
        txtlogin = new javax.swing.JTextField();
        txtdataIncidente = new javax.swing.JTextField();
        txttelefone = new javax.swing.JTextField();
        txttarefa = new javax.swing.JTextField();
        txtdataFim = new javax.swing.JTextField();
        cadastrar = new javax.swing.JButton();
        consultar = new javax.swing.JButton();
        sair = new javax.swing.JButton();
        jScrollPane3 = new javax.swing.JScrollPane();
        areaResultado = new javax.swing.JTextArea();
        jScrollPane2 = new javax.swing.JScrollPane();
        atxtnotas = new javax.swing.JTextArea();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        lbllogin.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        lbllogin.setText("Login:");

        lbldataIncidente.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        lbldataIncidente.setText("Data do Incidente:");

        lbltelefone.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        lbltelefone.setText("Telefone:");

        lbltarefa.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        lbltarefa.setText("Tarefa:");

        lbltipo.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        lbltipo.setText("Tipo:");

        grupo.add(optmigracao);
        optmigracao.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        optmigracao.setText("Migração");
        optmigracao.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                optmigracaoMouseClicked(evt);
            }
        });

        grupo.add(optlista);
        optlista.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        optlista.setText("Inclusão / Exclusão em Lista");
        optlista.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                optlistaMouseClicked(evt);
            }
        });

        grupo.add(optoutlook);
        optoutlook.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        optoutlook.setText("Outlook");
        optoutlook.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                optoutlookMouseClicked(evt);
            }
        });

        grupo.add(optoutros);
        optoutros.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        optoutros.setText("Outros");
        optoutros.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                optoutrosMouseClicked(evt);
            }
        });

        lbldataFim.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        lbldataFim.setText("Data de Encerramento:");

        lblnotas.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        lblnotas.setText("Notas:");

        txtlogin.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtloginKeyPressed(evt);
            }
        });

        txtdataIncidente.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtdataIncidenteKeyPressed(evt);
            }
        });

        txttelefone.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txttelefoneKeyPressed(evt);
            }
        });

        txttarefa.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txttarefaKeyPressed(evt);
            }
        });

        txtdataFim.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtdataFimKeyPressed(evt);
            }
        });

        cadastrar.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        cadastrar.setText("CADASTRAR");
        cadastrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cadastrarActionPerformed(evt);
            }
        });
        cadastrar.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                cadastrarKeyPressed(evt);
            }
        });

        consultar.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        consultar.setText("CONSULTAR");
        consultar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                consultarActionPerformed(evt);
            }
        });
        consultar.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                consultarKeyPressed(evt);
            }
        });

        sair.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        sair.setText("SAIR");
        sair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                sairActionPerformed(evt);
            }
        });

        areaResultado.setColumns(20);
        areaResultado.setRows(5);
        areaResultado.setAutoscrolls(false);
        jScrollPane3.setViewportView(areaResultado);

        atxtnotas.setColumns(20);
        atxtnotas.setLineWrap(true);
        atxtnotas.setRows(5);
        atxtnotas.setWrapStyleWord(true);
        atxtnotas.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                atxtnotasKeyPressed(evt);
            }
        });
        jScrollPane2.setViewportView(atxtnotas);

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel1.setText("RESULTADO DE PESQUISA");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lbldataFim)
                                    .addComponent(lblnotas))
                                .addGap(18, 18, 18)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtdataFim, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 315, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(lbltipo)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(optmigracao)
                                    .addComponent(optoutlook))
                                .addGap(27, 27, 27)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(optoutros)
                                    .addComponent(optlista)))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lbldataIncidente)
                                    .addComponent(lbltelefone)
                                    .addComponent(lbltarefa)
                                    .addComponent(lbllogin))
                                .addGap(18, 18, 18)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtlogin, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(txttelefone, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(txttarefa, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(txtdataIncidente, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(435, 435, 435))))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 836, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(cadastrar)
                        .addGap(28, 28, 28)
                        .addComponent(consultar)
                        .addGap(28, 28, 28)
                        .addComponent(sair))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(340, 340, 340)
                        .addComponent(jLabel1)))
                .addContainerGap(88, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(22, 22, 22)
                        .addComponent(lbllogin))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(txtlogin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbldataIncidente)
                    .addComponent(txtdataIncidente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbltelefone)
                    .addComponent(txttelefone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbltarefa)
                    .addComponent(txttarefa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lbltipo)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(optmigracao)
                    .addComponent(optlista))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(optoutros)
                    .addComponent(optoutlook))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbldataFim)
                    .addComponent(txtdataFim, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblnotas)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(22, 22, 22)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cadastrar)
                    .addComponent(consultar)
                    .addComponent(sair))
                .addGap(18, 18, 18)
                .addComponent(jLabel1)
                .addGap(18, 18, 18)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(90, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(58, 58, 58)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void cadastrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cadastrarActionPerformed
        
        
       if (txtlogin.getText().equals(""))
        {login =  null + ", ";}
        else
        {login = "'" + txtlogin.getText() + "', ";}
        

       if (txtdataIncidente.getText().equals(""))
        {dataIncidente = null + ", ";}
        else
        {dataIncidente = "'" + txtdataIncidente.getText() + "', ";}
        

        if (txttelefone.getText().equals(""))
        {telefone = null + ", ";}
        else
        {telefone = "'" + txttelefone.getText() + "', ";}
        

        if (txttarefa.getText().equals(""))
        {tarefa = null + ", ";}
        else
        {tarefa = "'" + txttarefa.getText() + "', ";}
        

        if (txtdataFim.getText().equals(""))
        {dataFim = null + ", ";}
        else
        {dataFim = "'" + txtdataFim.getText() + "', ";}
        

        if (atxtnotas.getText().equals(""))
        {lblnotas = null;}
        else
        {notas = "'" + atxtnotas.getText();}
        
    
        
        if(this.optmigracao.isSelected())
        { tipo = "'Migração', ";}
        if(this.optlista.isSelected())
        { tipo = "'Inclusão / Exclusão em Lista', ";}
        if(this.optoutlook.isSelected())
        { tipo = "'Outlook', ";}
        if(this.optoutros.isSelected())
        { tipo = "'Outros', ";}
       

       dados = login + dataIncidente + telefone + tarefa + tipo + dataFim + notas;

       str = "INSERT INTO dados ";
       str = str + "(login, dataIncidente,  telefone, tarefa, tipo, dataFim, notas) VALUES (";
       str = str + dados + " );"; 
        LayoutInterface li = new LayoutInterface();
        li.conectaBanco();
        li.cadastra(str);
        
               
        
    }//GEN-LAST:event_cadastrarActionPerformed

    private void sairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sairActionPerformed
       System.exit(0); // TODO add your handling code here:
    }//GEN-LAST:event_sairActionPerformed

    private void consultarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_consultarActionPerformed

                JFrame frame = new JFrame();
                frame.setContentPane(new ExibeRegistros());
                frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                frame.pack();
                frame.setVisible(true);
                frame.setExtendedState(MAXIMIZED_BOTH);
        
        




        
        
        
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        
        //CODIGO CERTO PARA USAR A AREA DE TEXTO
        
/*        str = "SELECT login, dataIncidente, telefone, tarefa, tipo, dataFim, notas FROM dados ORDER BY login ASC;" ;
        
        LayoutInterface li = new LayoutInterface();
        li.conectaBanco();
        
        
             resultSet = null; 
                    try
                    {
                    resultSet = statement.executeQuery (str);
                    
                        while (resultSet.next())
                        {
                        login = resultSet.getString("login");
                        dataIncidente = resultSet.getString("dataIncidente");
                        telefone = resultSet.getString("telefone");
                         tarefa = resultSet.getString("tarefa");
                        tipo = resultSet.getString("tipo");
                        dataFim = resultSet.getString("dataFim");
                        notas = resultSet.getString("notas");
                        areaResultado.append (login + "\t" + dataIncidente + "\t" + telefone + "\t" + tarefa + "\t" + tipo + "\t" + dataFim + "\t" + notas + "\n");
                               
                        }
                        connection.close ();
                      }
                      catch (Exception e)
                      {
                      System.out.println("Não foi possível consultar.");
                      }*/
   
    }//GEN-LAST:event_consultarActionPerformed

    private void txtloginKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtloginKeyPressed
      if (evt.getKeyCode()==10)
          txtdataIncidente.requestFocus();
      // TODO add your handling code here:
    }//GEN-LAST:event_txtloginKeyPressed

    private void txtdataIncidenteKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtdataIncidenteKeyPressed
            if (evt.getKeyCode()==10)
          txttelefone.requestFocus();        // TODO add your handling code here:
    }//GEN-LAST:event_txtdataIncidenteKeyPressed

    private void txttelefoneKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txttelefoneKeyPressed
      if (evt.getKeyCode()==10)
          txttarefa.requestFocus();  // TODO add your handling code here:
    }//GEN-LAST:event_txttelefoneKeyPressed

    private void txttarefaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txttarefaKeyPressed
           if (evt.getKeyCode()==10)
          optmigracao.requestFocus();        // TODO add your handling code here:
    }//GEN-LAST:event_txttarefaKeyPressed

    private void txtdataFimKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtdataFimKeyPressed
     if (evt.getKeyCode()==10)
          atxtnotas.requestFocus();   // TODO add your handling code here:
    }//GEN-LAST:event_txtdataFimKeyPressed

    private void optmigracaoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_optmigracaoMouseClicked
        txtdataFim.requestFocus();// TODO add your handling code here:
    }//GEN-LAST:event_optmigracaoMouseClicked

    private void optoutlookMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_optoutlookMouseClicked
        txtdataFim.requestFocus();        // TODO add your handling code here:
    }//GEN-LAST:event_optoutlookMouseClicked

    private void optlistaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_optlistaMouseClicked
        txtdataFim.requestFocus();        // TODO add your handling code here:
    }//GEN-LAST:event_optlistaMouseClicked

    private void optoutrosMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_optoutrosMouseClicked
        txtdataFim.requestFocus();        // TODO add your handling code here:
    }//GEN-LAST:event_optoutrosMouseClicked

    private void atxtnotasKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_atxtnotasKeyPressed
       if (evt.getKeyCode()==10)
          cadastrar.requestFocus(); // TODO add your handling code here:
    }//GEN-LAST:event_atxtnotasKeyPressed

    private void cadastrarKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_cadastrarKeyPressed
        if (evt.getKeyCode()==10)
          consultar.requestFocus();        // TODO add your handling code here:
    }//GEN-LAST:event_cadastrarKeyPressed

    private void consultarKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_consultarKeyPressed
       if (evt.getKeyCode()==10)
          sair.requestFocus(); // TODO add your handling code here:
    }//GEN-LAST:event_consultarKeyPressed

    
   public void conectaBanco ()
{
    try 
    {
        Class.forName("com.mysql.jdbc.Driver");
        connection = DriverManager.getConnection("jdbc:mysql://localhost/siscodiwa","wtf","wtf");
        statement = connection.createStatement();
        //System.out.println("Banco de dados conectado com sucesso!");
        JOptionPane.showMessageDialog(null, "Banco de dados conectado com sucesso!");

    }
    catch (Exception e)
    {
        JOptionPane.showMessageDialog(null, "Erro: Banco de dados não conectado.!");
        //System.out.println("Banco de dados não conectado");
    }
}

public void cadastra(String sql) 
{ 
        try 
        { 
        statement = null; 
        statement = connection.createStatement(); 
        statement.executeUpdate(sql); 
        JOptionPane.showMessageDialog(null, "Dados cadastrados com sucesso!");
       // System.out.println ("Dados cadastrados com sucesso!");
        } 
        catch (Exception e) 
        { 
        JOptionPane.showMessageDialog(null, "Erro: Dados não cadastrados!");
        //System.out.println("Erro: Dados não cadastrados!"); 
        } 
}

    
    
  /////////////////////////////////////

   
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextArea areaResultado;
    private javax.swing.JTextArea atxtnotas;
    private javax.swing.JButton cadastrar;
    private javax.swing.JButton consultar;
    private javax.swing.ButtonGroup grupo;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JLabel lbldataFim;
    private javax.swing.JLabel lbldataIncidente;
    private javax.swing.JLabel lbllogin;
    private javax.swing.JLabel lblnotas;
    private javax.swing.JLabel lbltarefa;
    private javax.swing.JLabel lbltelefone;
    private javax.swing.JLabel lbltipo;
    private javax.swing.JRadioButton optlista;
    private javax.swing.JRadioButton optmigracao;
    private javax.swing.JRadioButton optoutlook;
    private javax.swing.JRadioButton optoutros;
    private javax.swing.JButton sair;
    private javax.swing.JTextField txtdataFim;
    private javax.swing.JTextField txtdataIncidente;
    private javax.swing.JTextField txtlogin;
    private javax.swing.JTextField txttarefa;
    private javax.swing.JTextField txttelefone;
    // End of variables declaration//GEN-END:variables
}
